package edu.mju.eduservice.controller;

import edu.mju.commonutils.ReturnCode;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author:wyp
 * @Date:2020/8/27 22:06
 * CrossOrigin:解决跨域
 */
@RestController
@RequestMapping("/eduservice/user")
public class StudyLoginController {

    /**
     *  登陆
     * @return json格式 token
     */
    @PostMapping("/login")
    public ReturnCode login(){
        Map<String,Object> map = new HashMap<>();
        map.put("token","admin");
        return ReturnCode.success().data(map);
    }


    /**
     *  登陆信息
     * @return json格式 [roles,name,avatar]
     */
    @GetMapping("/info")
    public ReturnCode info(){
        Map<String,Object> map = new HashMap<>();
        map.put("roles","[admin]");
        map.put("name","admin");
        map.put("avatar","https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1466693411,1041230828&fm=26&gp=0.jpg");
        return ReturnCode.success().data(map);
    }
}
